const express = require('express');
const router = new express.Router();

/**
 * @param {Object} options
 * @param {} options.filter 编号或者名称
 * @param {} options.type 类型
 * @throws {Error}
 * @return {Promise}
 */
router.get('/base/simple', async(req, res, next) => {
    const options = {
        filter: req.query.filter,
        type: req.query.type
    };
    const data = {
        message: 'message',
        payload: {
            content: [
                {
                    id: 'id161',
                    code: 'code162',
                    name: 'name163',
                    type: 1
                },
                {
                    id: 'id164',
                    code: 'code165',
                    name: 'name166',
                    type: 1
                }
            ]
        }
    };
    res.json(data);
});
/**
 * @param {Object} options
 * @param {} options.code 编号
 * @param {} options.name 名称
 * @param {} options.type 类型
 * @param {} options.pageSize 每页数据量
 * @param {} options.pageIndex 指定页
 * @param {} options.sortField 排序字段
 * @param {} options.isDesc 倒序排列
 * @throws {Error}
 * @return {Promise}
 */
router.get('/base', async(req, res, next) => {
    const options = {
        code: req.query.code,
        name: req.query.name,
        type: req.query.type,
        pageSize: req.query.pageSize,
        pageIndex: req.query.pageIndex,
        sortField: req.query.sortField,
        isDesc: req.query.isDesc
    };
    const data = {
        message: 'message',
        payload: {
            content: [
                {
                    id: 'id167',
                    code: 'code168',
                    name: 'name169',
                    type: 1
                },
                {
                    id: 'id170',
                    code: 'code171',
                    name: 'name172',
                    type: 1
                }
            ],
            pageIndex: null,
            pageSize: null,
            sort: null,
            totalElements: 50,
            totalPages: null
        }
    };
    res.json(data);
});
/**
 * @param {Object} options
 * @param {} options.brandId 品牌id
 * @param {} options.code 编号
 * @param {} options.name 名称
 * @param {} options.status 状态
 * @param {} options.type 类型
 * @param {} options.isSecondClaim 是否生成二次索赔
 * @param {} options.isInsideShare 是否生成内部分摊
 * @param {} options.pageSize 每页数据量
 * @param {} options.pageIndex 指定页
 * @param {} options.sortField 排序字段
 * @param {} options.isDesc 倒序排列
 * @throws {Error}
 * @return {Promise}
 */
router.get('/', async(req, res, next) => {
    const options = {
        brandId: req.query.brandId,
        code: req.query.code,
        name: req.query.name,
        status: req.query.status,
        type: req.query.type,
        isSecondClaim: req.query.isSecondClaim,
        isNeedPicture: req.query.isNeedPicture,
        isInsideShare: req.query.isInsideShare,
        pageSize: req.query.pageSize,
        pageIndex: req.query.pageIndex,
        sortField: req.query.sortField,
        isDesc: req.query.isDesc
    };
    const data = {
        message: 'message',
        payload: {
            content: [
                {
                    id: 'id173',
                    code: 'code174',
                    name: 'name175',
                    brandId: 'id1',
                    brandCode: 'code2',
                    brandName: 'name3',
                    status: 1,
                    isSecondClaim: true,
                    isInsideShare: true,
                    isNeedPicture: true,
                    remark: 'remark',
                    rowVersion: 'rowVersion',
                    options: ['update', 'start', 'stop'],
                },
                {
                    id: 'id178',
                    code: 'code179',
                    name: 'name180',
                    brandId: 'id4',
                    brandCode: 'code5',
                    brandName: 'name6',
                    status: 1,
                    isSecondClaim: true,
                    isInsideShare: true,
                    isNeedPicture: true,
                    remark: 'remark',
                    rowVersion: 'rowVersion',
                    options: ['update', 'start', 'stop'],
                }
            ],
            pageIndex: null,
            pageSize: null,
            sort: null,
            totalElements: 50,
            totalPages: null
        }
    };
    res.json(data);
});
/**
 * @param {Object} options
 * @throws {Error}
 * @return {Promise}
 */
router.post('/', async(req, res, next) => {
    const options = {
    };
    const data = {
        message: 'message'
    };
    res.json(data);
});
/**
 * @param {Object} options
 * @param {} options.id id
 * @throws {Error}
 * @return {Promise}
 */
router.get('/:id', async(req, res, next) => {
    const options = {
        id: req.params.id
    };
    const data = {
        message: 'message',
        payload: {
            id: 'id183',
            brandId: 'brandId184',
            brandCode: 'brandCode185',
            brandName: 'brandName186',
            code: 'code187',
            name: 'name188',
            status: 1,
            isSecondClaim: true,
            isInsideShare: true,
            isNeedPicture: true,
            remark: 'remark',
            rowVersion: 'rowVersion',
            options: ['update', 'start', 'stop'],
            details: [
                {
                    personnelId: 'personnelId189',
                    personnelName: 'personnelName190'
                },
                {
                    personnelId: 'personnelId191',
                    personnelName: 'personnelName192'
                }
            ],
            dutyUnitShareRates: [
                {
                    id: '1',
                    startTime: '2019-09-04T02:37:44.918Z',
                    endTime: '2019-10-04T02:37:44.918Z',
                    shareRate: 0.5,
                },
                {
                    id: '2',
                    startTime: '2019-10-05T02:37:44.918Z',
                    endTime: '2019-11-04T02:37:44.918Z',
                    shareRate: 0.5,
                },
                {
                    id: '3',
                    startTime: '2019-11-05T02:37:44.918Z',
                    endTime: '2019-12-04T02:37:44.918Z',
                    shareRate: 0.5,
                }
            ]
        }
    };
    res.json(data);
});
/**
 * @param {Object} options
 * @param {} options.id Id
 * @throws {Error}
 * @return {Promise}
 */
router.put('/:id', async(req, res, next) => {
    const options = {
        id: req.params.id
    };
    const data = {
        message: 'message'
    };
    res.json(data);
});
/**
 * @param {Object} options
 * @param {} options.id 责任单位Id
 * @throws {Error}
 * @return {Promise}
 */
router.put('/:id/start', async(req, res, next) => {
    const options = {
        id: req.params.id
    };
    const data = {
        message: 'message'
    };
    res.json(data);
});
/**
 * @param {Object} options
 * @param {} options.id 责任单位Id
 * @throws {Error}
 * @return {Promise}
 */
router.put('/:id/stop', async(req, res, next) => {
    const options = {
        id: req.params.id
    };
    const data = {
        message: 'message'
    };
    res.json(data);
});
module.exports = router;
